library(ggplot2)

# These results are generated by `n-gram frequency.ipynb`

data <- data.frame(
  Platform = rep(c("Blog", "Facebook", "Forum", "MeetUp"), 2),
  grams = c(rep("Bigrams", 4), rep("Trigrams", 4)),
  Frequency = c(0.002342*100, 0.001425*100, 0.000788*100, 0.004526*100,
                0.000053*100, 0.000047*100, 0.000004*100, 0.000094*100)
)



# Create a bar chart for bigram frequencies
ggsave(filename = "output/figures/figure_4.pdf", width = 8, height = 4,
       ggplot(data, aes(x = Platform, y = Frequency)) +
         geom_col() +
         facet_wrap("grams", scales = "free_y") +
         labs(
           title = "Frequency by Platform",
           x = "Platform",
           y = "Frequency (%)"
         ) +
         theme_bw()
)